<include file="public@header"/>
<link rel="stylesheet" href="__STATIC__/js/element/css/element.css">
<style>
    [v-cloak] {
        display: none !important;
    }
    .avatar-uploader .el-upload {
        border: 0px dashed #d9d9d9;
        background-color: #fff;
        cursor: pointer;
        position: relative;
    }
    .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
    }
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 130px;
        height: 160px;
        line-height: 160px;
        text-align: center;
    }
    .avatar {
        width: 130px;
        height: 160px;
        display: block;
    }
    .el-upload{
        display: block;
        text-align: left;
    }
    input[type="file"] {
        display: none !important;
    }
    .tab-height {
        height: 60px;
        line-height: 60px;
        text-align: center;
    }
    .tab-height_2 {
        height: 120px;
        line-height: 120px;
        text-align: center;
    }
    .tab-height_3 {
        height: 180px;
        line-height: 180px;
        text-align: center;
    }
    .tab-height_4 {
        height: 240px;
        line-height: 240px;
        text-align: center;
    }
    .tab-height_6 {
        height: 360px;
        line-height: 360px;
        text-align: center;
    }
    .th-class {
        background-color: rgb(249, 249, 249);
    }
    .td-class .el-input__inner{
        border: 0 none;
        text-align: center;
    }
    .border-top {
        border-top: 1px solid rgb(229, 229, 229);
        border-left: 1px solid rgb(229, 229, 229);
    }
    .border-only-top {
        border-top: 1px solid rgb(229, 229, 229);
    }
    .border-right {
        border-right: 1px solid rgb(229, 229, 229);
    }
    .border-left {
        border-left: 1px solid rgb(229, 229, 229);
    }
    .border-bottom {
        border-bottom: 1px solid rgb(229, 229, 229);
        border-right: 1px solid rgb(229, 229, 229);
    }
    .el-textarea__inner {
        border: 0px solid;
    }
    .parent {
        display: flex;
    }
    .left {
        width: 70%;
        height: 100%;
    }
    .right {
        display: flex;
        flex: 1;
        height: 100%;
        margin-top: 30px;
    }
    .right-input{
        width: 200px;
    }
    .el-form-item{
        margin-bottom: 5px !important;
    }
    .shuli{ margin:10px auto;width:20px;line-height:24px;}
    .tree_class{
        background-color: rgb(84, 92, 100);
        color: #fff;
        padding: 10px 0px;
    }
    .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
        background-color:rgb(67, 74, 80);
        color: rgb(255, 208, 75);
    }
    .el-tree-node__content{
        padding: 20px;
    }
    .el-tree-node__content:hover{
        background-color:rgb(67, 74, 80);
    }
    :focus{
        outline: -webkit-focus-ring-color auto 0px;
    }
    .textChange{
        word-break: break-all;
    }

    .table_title2{
        width: 30px;
        text-align: center;
        font-weight: bold;
        background-color: rgb(225 243 255);
        padding: 10px;
    }
    .table_title{
        width: 60px;
        text-align: center;
        font-weight: bold;
        background-color: rgb(225 243 255);
    }
    .the_title{
        text-align: center;
        font-weight: bold;
        background-color: rgb(225 243 255);
    }
    .table_input{
        width: 80px;
        text-align: center;
    }
    .td_cls{border:solid rgb(107,147,171); border-width:0px 1px 1px 0px;}
    .table_cls{border:solid rgb(107,147,171); border-width:1px 0px 0px 1px;}
    .dialog_bg{
        background-color: rgb(225 243 255);
    }
    .el-input__inner{
        border-radius: 0;
        padding: 0 5px;
    }

    .wraps {
        margin: 0;
        width: 80%;
        display: flex;
    }
    #wrap_left {
        flex: 0 0 100px;
    }
    #wrap_right {
        flex: 1;
    }

</style>
</head>
<body>

<div class="wrap js-check-wrap" id="app" v-cloak>
    <ul class="nav nav-tabs">
        <li class="active"><a href="#">人才管理库</a></li>
    </ul>
    <el-row class="tac" style="padding: 20px">
        <el-col :span="4">
            <el-tree :data="left_data" :props="defaultProps" @node-click="changeCompany" :default-expand-all="true"  class="tree_class" :highlight-current="true"></el-tree>
        </el-col>
        <el-col :span="20" style="padding-left: 20px">
            <div class="wraps" v-if="table_tag==1">
                <div id="wrap_left">
                    <el-button type="primary" icon="el-icon-plus" @click="open_dialog">增加</el-button>
                </div>
                <div id="wrap_right">
                    <el-upload
                            style="text-align: left;"
                            :action="upload_path"
                            :show-file-list="false"
                            :on-success="handleFileSuccess">
                        <el-button type="success" icon="el-icon-download" :loading="exportStatus">导入数据</el-button>
                    </el-upload>
                </div>
            </div>

            <div style="margin: 20px 0;" v-if="table_tag==1">
                <el-form :inline="true" :model="formInline" class="demo-form-inline">
                    <el-form-item label="姓名">
                        <el-input v-model="formInline.name" placeholder="姓名"></el-input>
                    </el-form-item>
                    <el-form-item label="身份证号码">
                        <el-input v-model="formInline.id_card" placeholder="身份证号码"></el-input>
                    </el-form-item>
                    <el-form-item label="工作单位及职位">
                        <el-input v-model="formInline.work_unit" placeholder="工作单位及职位"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="getList">查询</el-button>
                    </el-form-item>
                </el-form>
            </div>

            <el-table
                    :data="tableList"
                    v-loading="loading"
                    stripe
                    style="width: 100%"
                    v-if="table_tag==1">
                <el-table-column
                        prop="name"
                        label="姓名"
                        width="180">
                </el-table-column>
                <el-table-column
                        prop="work_unit"
                        label="工作单位及职务">
                </el-table-column>
                <el-table-column
                        prop="job_type"
                        label="职位类别">
                </el-table-column>
                <el-table-column
                        prop="now_position_time"
                        label="任现服务时间">
                </el-table-column>
                <el-table-column
                        prop="position_level"
                        label="职位层次">
                </el-table-column>
                <el-table-column
                        prop="job_rank_time"
                        label="任现职务层次时间">
                </el-table-column>

                <el-table-column
                        label="操作">
                    <template slot-scope="scope">
                        <el-button @click="edit_dialog(scope.row.id)" type="warning" icon="el-icon-edit" size="small">修改</el-button>
                        <el-button type="danger" icon="el-icon-delete" size="small" @click="deleted(scope.row.id)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>


            <el-table
                    :data="tableList"
                    v-loading="loading"
                    stripe
                    style="width: 100%"
                    v-if="table_tag==2">
                <el-table-column
                        prop="project_name"
                        label="项标名称"
                        width="180">
                </el-table-column>
                <el-table-column
                        prop="discount"
                        label="折扣率">
                </el-table-column>
                <el-table-column
                        prop="supplier_name"
                        label="中标供应商名称">
                </el-table-column>
                <el-table-column
                        prop="supplier_address"
                        label="中标供应商地址">
                </el-table-column>
                <el-table-column
                        prop="name"
                        label="总协调人">
                </el-table-column>
                <el-table-column
                        prop="phone"
                        label="联系电话">
                </el-table-column>

            </el-table>

            <div style="margin-top: 20px;">
                <el-pagination
                        background
                        layout="prev, pager, next"
                        :total="total_page">
                </el-pagination>
            </div>
        </el-col>
    </el-row>


    <!-- 添加  -->
    <el-dialog title="人才信息" :visible.sync="dialogTableVisible" :close-on-click-modal="false" width="40%" custom-class="dialog_bg">
        <div class="parent">
            <div class="left">
                <el-tabs v-model="activeName" @tab-click="handleClick">
                    <el-tab-pane label="任免审批表(一)" name="first" style="height: 700px;width: 550px;">
                        <table  width="550" cellspacing="0" class="table_cls">
                            <tr>
                                <td class="table_title td_cls">姓名</td>
                                <td class="table_input td_cls"><el-input v-model="form.name" class="td-class"></el-input></td>
                                <td class="table_title td_cls">性别</td>
                                <td class="table_input td_cls"><el-input v-model="form.sex" class="td-class"></el-input></td>
                                <td class="table_title td_cls">出生年月</td>
                                <td class="table_input td_cls"><el-input v-model="form.birthday" class="td-class"></el-input></td>
                                <td rowspan="4" style="text-align: center;" class="td_cls">
                                    <el-upload
                                            class="avatar-uploader"
                                            :action="upload_path"
                                            :show-file-list="false"
                                            :on-success="handleAvatarSuccess"
                                            :before-upload="beforeAvatarUpload">
                                        <img v-if="imageUrl" :src="imageUrl" class="avatar">
                                        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                                    </el-upload>
                                </td >
                            </tr>
                            <tr>
                                <td class="table_title td_cls">民族</td>
                                <td class="table_input td_cls"><el-input v-model="form.nation" class="td-class"></el-input></td>
                                <td class="table_title td_cls">籍贯</td>
                                <td class="table_input td_cls"><el-input v-model="form.native_place" class="td-class"></el-input></td>
                                <td class="table_title td_cls">出生地</td>
                                <td class="table_input td_cls"><el-input v-model="form.born_address" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td class="table_title td_cls">入党时间</td>
                                <td class="table_input td_cls"><el-input v-model="form.join_time" class="td-class"></el-input></td>
                                <td class="table_title td_cls">参加工作时间</td>
                                <td class="table_input td_cls"><el-input v-model="form.work_time" class="td-class"></el-input></td>
                                <td class="table_title td_cls">健康状况</td>
                                <td class="table_input td_cls"><el-input v-model="form.health" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td class="table_title td_cls">专业技术职位</td>
                                <td class="table_input td_cls" colspan="2"><el-input v-model="form.technology" class="td-class"></el-input></td>
                                <td class="table_title td_cls">熟悉专业有何特长</td>
                                <td class="table_input td_cls" colspan="2"><el-input v-model="form.specialty" class="td-class"></el-input></td>
                            </tr>

                            <tr>
                                <td rowspan="4" class="the_title td_cls">学历学位</td>
                                <td rowspan="2" class="the_title td_cls">全日制教育</td>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="full_time_schooling_one" class="td-class"></el-input></td>
                                <td rowspan="2" class="the_title td_cls">毕业院校系及专业</td>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="graduate_school_one_one" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="full_time_schooling_two" class="td-class"></el-input></td>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="graduate_school_one_two" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td rowspan="2" class="the_title td_cls">在职教育</td>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="online_schooling_one" class="td-class"></el-input></td>
                                <td rowspan="2" class="the_title td_cls">毕业院校系及专业</td>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="graduate_school_two_one" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="online_schooling_two" class="td-class"></el-input></td>
                                <td style="text-align: center;" colspan="2" class="td_cls"><el-input v-model="graduate_school_two_two" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td colspan="2" class="the_title td_cls">姓名工作单位及职务</td>
                                <td style="text-align: center;" colspan="5" class="td_cls"><el-input v-model="form.work_unit" class="td-class"></el-input></td>
                            </tr>
                            <tr>
                                <td class="table_title td_cls">简历</td>
                                <td style="text-align: center;" colspan="6" class="td_cls">
                                    <el-input type="textarea" :autosize="{ minRows: 8, maxRows: 2}" placeholder="请输入简介" v-model="form.resume" class="td-class" resize="none"></el-input>
                                </td>
                            </tr>
                        </table>
                    </el-tab-pane>
                    <el-tab-pane label="任免审批表(二)" name="second" style="height: 700px;width: 550px;">
                        <table  width="550" cellspacing="0" class="table_cls">
                            <tr>
                                <td class="table_title2 td_cls">奖惩综述</td>
                                <td style="text-align: center;width: 470px" class="td_cls">
                                    <el-input type="textarea" :autosize="{ minRows: 6, maxRows: 2}" placeholder="请输入奖惩综述"
                                              v-model="form.rewards" class="td-class" resize="none"></el-input>
                                </td>
                            </tr>
                            <tr>
                                <td class="table_title2 td_cls">年度考核综述</td>
                                <td style="text-align: center;width: 470px;" class="td_cls">
                                    <el-input type="textarea" :autosize="{ minRows: 6, maxRows: 2}" placeholder="请输入年度考核综述"
                                              v-model="form.assessment" class="td-class" resize="none"></el-input>
                                </td>
                            </tr>
                            <tr>
                                <td class="table_title2 td_cls">家庭主要成员及社会重要关系</td>
                                <td style="text-align: center;width: 470px;overflow-y:scroll;" class="td_cls">
                                    <el-table :data="tableData" style="width: 100%">
                                        <el-table-column prop="appellation" label="称谓" width="100" >
                                            <template scope="scope" >
                                                <el-input size="small" v-model="scope.row.appellation" ></el-input>
                                            </template>
                                        </el-table-column>
                                        <el-table-column prop="name" label="姓名" width="100">
                                            <template scope="scope" >
                                                <el-input size="small" v-model="scope.row.name" ></el-input>
                                            </template>
                                        </el-table-column>
                                        <el-table-column prop="birthday" label="出生日期" width="100">
                                            <template scope="scope" >
                                                <el-input size="small" v-model="scope.row.birthday" ></el-input>
                                            </template>
                                        </el-table-column>
                                        <el-table-column prop="political_outlook" label="政治面貌" width="100">
                                            <template scope="scope" >
                                                <el-input size="small" v-model="scope.row.political_outlook" ></el-input>
                                            </template>
                                        </el-table-column>
                                        <el-table-column prop="job" label="工作单位及职务" width="120">
                                            <template scope="scope" >
                                                <el-input size="small" v-model="scope.row.job" ></el-input>
                                            </template>
                                        </el-table-column>

                                    </el-table>
                                </td>
                            </tr>
                        </table>
                    </el-tab-pane>
<!--                    <el-tab-pane label="其他信息"></el-tab-pane>-->
<!--                    <el-tab-pane label="工资信息"></el-tab-pane>-->
                </el-tabs>
            </div>
            <div class="right">
                <el-form ref="form" :model="form" label-width="150px">
                    <el-form-item label="统计关系所在单位">
                        <el-select v-model="form.company_id" placeholder="请选择" @change="selectCompany">
                            <el-option-group
                                    v-for="group in options"
                                    :key="group.label"
                                    :label="group.label">
                                <el-option
                                        v-for="item in group.options"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                </el-option>
                            </el-option-group>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="身份证号">
                        <el-input v-model="form.id_card" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="管理类别">
                        <el-input v-model="form.manage_type" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="人员类别">
                        <el-input v-model="form.person_type" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="编制类别">
                        <el-input v-model="form.organization_type" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="职位类别">
                        <el-input v-model="form.job_type" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="现领导职位">
                        <el-input v-model="form.leader_position" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="任现领导时间">
                        <el-input v-model="form.leader_position_time" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="现职级">
                        <el-input v-model="form.now_position" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="任现职级时间">
                        <el-input v-model="form.now_position_time" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="任相当层次">
                        <el-input v-model="form.position_level" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item label="职务职级时间">
                        <el-input v-model="form.job_rank_time" class="right-input"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit" :loading="btnLoading">{{btn_msg}}</el-button>
                        <el-button @click="close_dialog">取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </el-dialog>


</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="__STATIC__/js/element/js/element.js"></script>


<script type="text/javascript">

    let app = new Vue({
        el: '#app',
        data: {
            formInline: {
                name: '',
                id_card: '',
                work_unit: '',
            },
            left_data: [{
                id: '1',
                label: '国家审计局',
                children: [{
                    id: '2',
                    label: '台州市审计局',
                    children: [{
                        id: '3',
                        label: '椒江区审计局'
                    },{
                        id: '4',
                        label: '路桥区审计局'
                    },{
                        id: '5',
                        label: '黄岩区审计局'
                    },{
                        id: '6',
                        label: '临海市审计局'
                    },{
                        id: '7',
                        label: '温岭市审计局'
                    },{
                        id: '8',
                        label: '三门县审计局'
                    },{
                        id: '9',
                        label: '天台县审计局'
                    },{
                        id: '10',
                        label: '仙居县审计局'
                    },{
                        id: '11',
                        label: '玉环县审计局'
                    }]
                }]
            }, {
                id: '12',
                label: '内部审计局',
                children: [{
                    id: '13',
                    label: '椒江区审计局'
                }, {
                    id: '14',
                    label: '路桥区审计局'
                }, {
                    id: '15',
                    label: '黄岩区审计局'
                }, {
                    id: '16',
                    label: '临海市审计局'
                }, {
                    id: '17',
                    label: '温岭市审计局'
                }, {
                    id: '18',
                    label: '三门县审计局'
                }, {
                    id: '19',
                    label: '天台县审计局'
                }, {
                    id: '20',
                    label: '仙居县审计局'
                }, {
                    id: '21',
                    label: '玉环县审计局'
                }, {
                    id: '22',
                    label: '社会审计局',
                    children: [{
                        id: '23',
                        label: '浙江同方会计师事务所有限公司',
                    },{
                        id: '24',
                        label: '致同会计师事务所(特殊普通合伙)温州分所',
                    },{
                        id: '25',
                        label: '浙江中和联合会计师事务所(普通合伙)',
                    },{
                        id: '26',
                        label: '浙江中企华会计师事务所有限公司',
                    },{
                        id: '27',
                        label: '上海八达国瑞房地产土地估价有限公司',
                    },{
                        id: '28',
                        label: '大信会计师事务所(特殊普通合伙)',
                    },{
                        id: '29',
                        label: '台州中衡会计师事务所有限公司',
                    },{
                        id: '30',
                        label: '浙江中永中天会计师事务所有限公司',
                    },{
                        id: '31',
                        label: '台州鑫泰会计师事务所(普通合伙)',
                    },{
                        id: '32',
                        label: '台州跃龙会计师事务所(普通合伙)',
                    },{
                        id: '33',
                        label: '台州文博会计师事务所',
                    },{
                        id: '34',
                        label: '台州安信会计师事务所有限公司',
                    },{
                        id: '35',
                        label: '台州天盛会计师事务所有限公司',
                    },{
                        id: '36',
                        label: '浙江天平会计师事务所(特殊普通合伙)',
                    },{
                        id: '37',
                        label: '辽宁新青年工程咨询有限公司',
                    },{
                        id: '38',
                        label: '台州天一会计师事务所有限公司',
                    },{
                        id: '39',
                        label: '台州联信房地产资产评估有限公司',
                    },{
                        id: '40',
                        label: '台州宏诚会计师事务所有限公司',
                    },{
                        id: '41',
                        label: '浙江正大会计师事务所有限公司',
                    },{
                        id: '42',
                        label: '杭州聚信会计师事务所(普通合伙)',
                    }]
                }]
            }],
            options: [{
                label: '国家审计局',
                options: [{
                    value: '1-2',
                    label: '台州审计局',
                },{
                    value: '1-2-1',
                    label: '椒江区审计局',
                }, {
                    value: '1-2-2',
                    label: '路桥区审计局',
                }, {
                    value: '1-2-3',
                    label: '黄岩区审计局',
                }, {
                    value: '1-2-4',
                    label: '临海市审计局',
                }, {
                    value: '1-2-5',
                    label: '温岭市审计局',
                }, {
                    value: '1-2-6',
                    label: '三门县审计局',
                }, {
                    value: '1-2-7',
                    label: '天台县审计局',
                }, {
                    value: '1-2-8',
                    label: '仙居县审计局',
                }, {
                    value: '1-2-9',
                    label: '玉环县审计局',
                }]
            }, {
                label: '内部审计局',
                options: [{
                    value: '2-1',
                    label: '椒江区审计局'
                }, {
                    value: '2-2',
                    label: '路桥区审计局'
                }, {
                    value: '2-3',
                    label: '黄岩区审计局'
                }, {
                    value: '2-4',
                    label: '临海市审计局'
                }, {
                    value: '2-5',
                    label: '温岭市审计局'
                }, {
                    value: '2-6',
                    label: '三门县审计局'
                }, {
                    value: '2-7',
                    label: '天台县审计局'
                }, {
                    value: '2-8',
                    label: '仙居县审计局'
                }, {
                    value: '2-9',
                    label: '玉环县审计局'
                }]
            }],
            defaultProps: {
                children: 'children',
                label: 'label'
            },
            btn_msg:'立即创建',
            upload_path:GV.ROOT + 'user/Asset/webuploader_img',
            dialogTableVisible: false,
            activeName: 'first',
            imageUrl: '',
            full_time_schooling_one:'',
            full_time_schooling_two:'',
            graduate_school_one_one:'',
            graduate_school_one_two:'',
            online_schooling_one:'',
            online_schooling_two:'',
            graduate_school_two_one:'',
            graduate_school_two_two:'',
            form_new: {
                name: '',
                sex: '',
                birthday: '',
                nation: '',
                native_place: '',
                avatar: '',
                join_time: '',
                work_time: '',
                health: '',
                born_address: '',
                technology: '',
                specialty: '',
                full_time_schooling: '',
                graduate_school_one: '',
                online_schooling: '',
                graduate_school_two: '',
                work_unit: '',
                resume: '',
                rewards: '',
                assessment: '',
                company: '',
                company_id: '',
                id_card: '',
                manage_type: '',
                person_type: '',
                organization_type: '',
                job_type: '',
                leader_position: '',
                leader_position_time: '',
                now_position: '',
                now_position_time: '',
                position_level: '',
                job_rank_time: '',
            },
            tableData_new: [
                {
                    appellation: '',
                    name: '',
                    birthday: '',
                    political_outlook: '',
                    job: ''
                },{
                    appellation: '',
                    name: '',
                    birthday: '',
                    political_outlook: '',
                    job: ''
                }, {
                    appellation: '',
                    name: '',
                    birthday: '',
                    political_outlook: '',
                    job: ''
                }, {
                    appellation: '',
                    name: '',
                    birthday: '',
                    political_outlook: '',
                    job: ''
                }, {
                    appellation: '',
                    name: '',
                    birthday: '',
                    political_outlook: '',
                    job: ''
                }, {
                    appellation: '',
                    name: '',
                    birthday: '',
                    political_outlook: '',
                    job: ''
                }],
            form: {
                name: '',
                sex: '',
                birthday: '',
                nation: '',
                native_place: '',
                avatar: '',
                join_time: '',
                work_time: '',
                health: '',
                born_address: '',
                technology: '',
                specialty: '',
                full_time_schooling: '',
                graduate_school_one: '',
                online_schooling: '',
                graduate_school_two: '',
                work_unit: '',
                resume: '',
                rewards: '',
                assessment: '',
                company: '',
                company_id: '',
                id_card: '',
                manage_type: '',
                person_type: '',
                organization_type: '',
                job_type: '',
                leader_position: '',
                leader_position_time: '',
                now_position: '',
                now_position_time: '',
                position_level: '',
                job_rank_time: '',
            },
            tableData: [
                {
                appellation: '',
                name: '',
                birthday: '',
                political_outlook: '',
                job: ''
            },{
                appellation: '',
                name: '',
                birthday: '',
                political_outlook: '',
                job: ''
            }, {
                appellation: '',
                name: '',
                birthday: '',
                political_outlook: '',
                job: ''
            }, {
                appellation: '',
                name: '',
                birthday: '',
                political_outlook: '',
                job: ''
            }, {
                appellation: '',
                name: '',
                birthday: '',
                political_outlook: '',
                job: ''
            }, {
                appellation: '',
                name: '',
                birthday: '',
                political_outlook: '',
                job: ''
            }],
            tableList: [],
            total_page:0,
            id:'',
            loading: true,
            exportStatus: false,
            btnLoading:false,
            table_tag:1

        },
        created: function () {
            this.getList();
        },
        methods: {
            //导入excel
            handleFileSuccess(res, file){
                let that = this;
                if(res.code == 200){
                    that.exportStatus = true;
                    let path = res.data.filepath
                    $.ajax({
                        url: GV.ROOT + 'admin/user/exportInTable',
                        data: {
                            path:path
                        },
                        dataType: "json",
                        type: "post",
                        traditional: true,
                        success: function (res) {
                            that.getList();
                            that.exportStatus = false;
                            that.$message({
                                message: '导入成功',
                                type: 'success'
                            });
                        }
                    });
                }
            },
            //下拉框选择
            selectCompany(val){
                let selectedWorkName = {};
                selectedWorkName = this.options.find((item)=>{
                    item.options.find((items)=>{
                        if(items.value === val){
                            this.form.company = items.label
                            this.form.company_id = items.value
                        }
                    })
                });
            },
            //左侧菜单点击
            changeCompany(data){
                this.form_new.company = data.label;
                this.form_new.company_id = data.id;
                if(data.id>22){
                    this.getCompanyList();
                }else{
                    this.getList();
                }
            },
            //获取列表
            getList(){
                this.loading = true
                let that = this;
                $.ajax({
                    url: GV.ROOT +"admin/user/talentManageList",
                    data: {
                        company_id:that.form_new.company_id,
                        name: that.formInline.name,
                        id_card: that.formInline.id_card,
                        work_unit: that.formInline.work_unit,
                    },
                    dataType: "json",
                    type: "post",
                    success: function(res) {
                        if(res.code === 200){
                            that.tableList = res.data.data;
                            that.total_page = res.data.total
                            that.table_tag = 1
                        }
                        that.loading = false
                    }
                });
            },
            //获取19家单位列表
            getCompanyList(){
                this.loading = true
                let that = this;
                $.ajax({
                    url: GV.ROOT +"admin/user/companyManageList",
                    data: {
                        id:that.form_new.company_id
                    },
                    dataType: "json",
                    type: "post",
                    success: function(res) {
                        if(res.code === 200){
                            that.tableList = res.data.data;
                            that.total_page = res.data.total
                            that.table_tag = 2
                        }
                        that.loading = false
                    }
                });
            },
            //删除
            deleted(id){
                let that = this;
                that.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        url: GV.ROOT +"admin/user/deletedTalentManage",
                        data: {
                            id:id
                        },
                        dataType: "json",
                        type: "post",
                        success: function(res) {
                            if(res.code === 200){
                                that.$message({
                                    type: 'success',
                                    message: res.message
                                });
                                that.getList();
                            }else{
                                that.$message.error(res.message);
                            }
                        }
                    });
                }).catch(() => {
                });
            },
            //打开添加
            open_dialog(){
                this.dialogTableVisible = true;
                this.activeName='first'
                this.form = this.form_new
                this.imageUrl = ''
                this.full_time_schooling_one= ''
                this.full_time_schooling_two= ''
                this.graduate_school_one_one= ''
                this.graduate_school_one_two= ''
                this.online_schooling_one= ''
                this.online_schooling_two= ''
                this.graduate_school_two_one= ''
                this.graduate_school_two_two= ''
                this.form_new.company= ''
                this.form_new.company_id= ''
                this.btn_msg = '立即创建'
                this.id=''
                this.tableData = this.tableData_new
            },
            //打开修改编辑
            edit_dialog(id){
                this.id = id;
                let that = this;
                $.ajax({
                    url: GV.ROOT +"admin/user/talentManageDetail",
                    data: {
                        id:id
                    },
                    dataType: "json",
                    type: "post",
                    success: function(res) {
                        if(res.code === 200){
                            that.form = res.data.detail;
                            if(res.data.list.length>0){
                                that.tableData = res.data.list;
                            }
                            that.imageUrl = res.data.avatar_url;
                            //全日制
                            let full_time_schooling = res.data.detail.full_time_schooling;
                            full_time_schooling=full_time_schooling.split(","); //字符分割
                            that.full_time_schooling_one = full_time_schooling[0];
                            that.full_time_schooling_two = full_time_schooling[1];
                            //毕业学校1
                            let graduate_school_one = res.data.detail.graduate_school_one;
                            graduate_school_one=graduate_school_one.split(","); //字符分割
                            that.graduate_school_one_one = graduate_school_one[0];
                            that.graduate_school_one_two = graduate_school_one[1];
                            //在职教育
                            let online_schooling = res.data.detail.online_schooling;
                            online_schooling=online_schooling.split(","); //字符分割
                            that.online_schooling_one = online_schooling[0];
                            that.online_schooling_two = online_schooling[1];
                            //毕业学校2
                            let graduate_school_two = res.data.detail.graduate_school_two;
                            graduate_school_two=graduate_school_two.split(","); //字符分割
                            that.graduate_school_two_one = graduate_school_two[0];
                            that.graduate_school_two_two = graduate_school_two[1];
                        }
                    }
                });
                that.dialogTableVisible = true;
                that.activeName='first'
                that.btn_msg = '修改'
            },
            close_dialog(){
                this.dialogTableVisible = false;
            },
            handleClick(tab, event) {
            },
            handleAvatarSuccess(res, file) {
                if(res.code == 200){
                    this.form.avatar = res.data.filepath
                }
                this.imageUrl = URL.createObjectURL(file.raw);
            },
            beforeAvatarUpload(file) {
                const isLt2M = file.size / 1024 / 1024 < 5;
                if (!isLt2M) {
                    this.$message.error('上传头像图片大小不能超过 5MB!');
                }
                return isLt2M;
            },
            onSubmit() {
                this.btnLoading = true
                this.form.full_time_schooling = this.full_time_schooling_one+','+this.full_time_schooling_two
                this.form.graduate_school_one = this.graduate_school_one_one+','+this.graduate_school_one_two
                this.form.online_schooling = this.online_schooling_one+','+this.online_schooling_two
                this.form.graduate_school_two = this.graduate_school_two_one+','+this.graduate_school_two_two

                let url = 'admin/user/addTalentManage';
                if(this.id !== ''){
                    url = 'admin/user/editTalentManage';
                }

                let that = this;
                $.ajax({
                    url: GV.ROOT + url,
                    data: {
                        id:that.id,
                        family:JSON.stringify(that.tableData),
                        form_data:JSON.stringify(that.form)
                    },
                    dataType: "json",
                    type: "post",
                    traditional: true,
                    success: function (res) {
                        if(res.code === 200){
                            that.$message({
                                message: res.message,
                                type: 'success'
                            });
                            that.dialogTableVisible = false;
                            that.getList();
                        }else{
                            that.$message.error(res.message);
                        }

                        that.btnLoading = true
                    }
                });
            }
        }

    })
</script>


</body>
</html>